<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>API docs for &ldquo;pymine.poster.streaminghttp&rdquo;</title>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <link href="apidocs.css" type="text/css" rel="stylesheet" />
    
    
  </head>
  <body>
    <h1 class="module">Module p.p.streaminghttp</h1>
    <p>
      <span id="part">Part of <a href="pymine.html">pymine</a>.<a href="pymine.poster.html">poster</a></span>
      
      
    </p>
    <div>
      
    </div>
    <div><p>Streaming HTTP uploads module.</p>
<p>This module extends the standard httplib and urllib2 objects so that 
iterable objects can be used in the body of HTTP requests.</p>
<p>In most cases all one should have to do is call 
:func:`register_openers()` to register the new streaming http handlers 
which will take priority over the default handlers, and then you can use 
iterable objects in the body of HTTP requests.</p>
<p>**N.B.** You must specify a Content-Length header if using an iterable 
object since there is no way to determine in advance the total size that 
will be yielded, and there is no way to reset an interator.</p>
<p>Example usage:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> StringIO <span class="py-keyword">import</span> StringIO
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">import</span> urllib2, poster.streaminghttp</pre>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>opener = poster.streaminghttp.register_openers()</pre>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>s = <span class="py-string">&quot;Test file data&quot;</span>
<span class="py-prompt">&gt;&gt;&gt; </span>f = StringIO(s)</pre>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>req = urllib2.Request(<span class="py-string">&quot;http://localhost:5000&quot;</span>, f, {<span class="py-string">'Content-Length'</span>: len(s)})</pre>
<table class="fieldTable"></table></div>
    
    
    <div id="splitTables">
      <table class="children sortable" id="id143">
  
  
  
  
  <tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp._StreamingHTTPMixin.html">_StreamingHTTPMixin</a></td>
    <td><span class="undocumented">No class docstring; 1/1 methods documented</span></td>
  </tr><tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp.StreamingHTTPConnection.html">StreamingHTTPConnection</a></td>
    <td><span>Subclass of `httplib.HTTPConnection` that overrides the `send()` 
method</span></td>
  </tr><tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp.StreamingHTTPRedirectHandler.html">StreamingHTTPRedirectHandler</a></td>
    <td><span>Subclass of `urllib2.HTTPRedirectHandler` that overrides the</span></td>
  </tr><tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp.StreamingHTTPHandler.html">StreamingHTTPHandler</a></td>
    <td><span>Subclass of `urllib2.HTTPHandler` that uses</span></td>
  </tr><tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp.StreamingHTTPSConnection.html">StreamingHTTPSConnection</a></td>
    <td><span>Subclass of `httplib.HTTSConnection` that overrides the `send()` 
method</span></td>
  </tr><tr class="class">
    
    
    <td>Class</td>
    <td><a href="pymine.poster.streaminghttp.StreamingHTTPSHandler.html">StreamingHTTPSHandler</a></td>
    <td><span>Subclass of `urllib2.HTTPSHandler` that uses</span></td>
  </tr><tr class="function">
    
    
    <td>Function</td>
    <td><a href="pymine.poster.streaminghttp.html#register_openers">register_openers</a></td>
    <td><span>Register the streaming http handlers in the global urllib2 default</span></td>
  </tr>
  
</table>
      
      
    </div>
    
    
    
    <div class="function">
        <a name="pymine.poster.streaminghttp.register_openers"></a>
        <a name="register_openers"></a>
        <div class="functionHeader">
        
        def register_openers():
        
      </div>
        <div class="functionBody">
          
          <div>Register the streaming http handlers in the global urllib2 default 
opener object.</p>
<p>Returns the created OpenerDirector object.<table class="fieldTable"></table></div>
        </div>
      </div>
    
    <address>
      <a href="index.html">API Documentation</a> for pymine, generated by <a href="http://codespeak.net/~mwh/pydoctor/">pydoctor</a> at 2010-04-07 23:15:24.
    </address>
  </body>
</html>